package engine

import (
	"log"
	"luiz/crawler/fetcher"
)

func Worker(r Request) (ParseResult, error) {
	//log.Printf("Fetching %s", r.Url)
	fetch, err := fetcher.Fetch(r.Url)
	if err != nil {
		log.Printf("Fetcher error,url is %v,error is %v", r.Url, err)
		return ParseResult{}, err
	}
	return r.Parser.Parse(fetch, r.Url), nil
}
